
//简单的一道入门题。
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int main()
{
	int month[12] = { 0 };
	int money=0, deposit=0;
	for (int i = 0; i < 12; i++)
		scanf("%d", &month[i]);
	for (int i = 0; i < 12; i++) {
		money += 300;
		money -= month[i];
		if (money >= 100) {
			deposit += (int)(money / 100) * 100;
			money = money % 100;
		}
		else if (money < 0) {
			printf("%d", -++i);
			return 0;
		}
	}
	money += deposit * 1.2;
	printf("%d", money);
	return 0;
}